import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { addCount } from "../../store/Counter/countSlice";
import { NavLink } from 'react-router-dom'

const List = () => {
  // 获取仓库数据  count
  const count = useSelector(state => state.counter.count)
  const dispatch = useDispatch()
  return <div>
    <h1>list</h1>

    <h3>count: { count }</h3>
    {/* 修改仓库数据唯一方法： dispatch(actions) */}
    <button onClick={() => dispatch(addCount())}>+1</button>

    <NavLink to='/'>去首页</NavLink>
  </div>;
};

export default List;
